Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] Log printing failure problem in agent mode #1513

Merged
merged 13 commits into from
Aug 9, 2024

Conversation

Pan-YuJie
Copy link
Contributor

Fixes #1428

At present, java prints logs mostly with slf4j and log4j/logback, but agent is a separate jar package.

To use slf4j, you need to introduce the package into agent, which may conflict with the business's own slf4j logback log.

And after the agent package uses the slf4j-api package, you need to ensure that the classLoader of the agent is consistent with the classLoader of the business, otherwise conflicts cannot be found or repeated.

How to remove conflict

In tomcat

The internal logging for Apache Tomcat uses JULI, a packaged renamed fork of Apache Commons Logging that is hard-coded to use the java.util.logging framework. This ensures that Tomcat's internal logging and any web application logging will remain independent, even if a web application uses Apache Commons Logging.

Reference: https://tomcat.apache.org/tomcat-9.0-doc/logging.html

In pinpoint and skywalking

Pinoint and skywalking create custom Logger class. They use sender class to transfer trace and metric to collector server.

Reference:


Solution

There is a Skywalking-like ILOG component in the agent-core package, which removes the ILog component from the existing agent-core package into the infra common package, so that other Agent modules can directly use the custom log component without relying on Slf4j to print the log, avoiding the problem of log non-printing.

Successfully solved:

image-20231112232442138


Copy link

codecov bot commented Nov 12, 2023

Codecov Report

Attention: 245 lines in your changes are missing coverage. Please review.

Comparison is base (bb6dbc7) 34.23% compared to head (3ca8b29) 30.66%.
Report is 2 commits behind head on develop.

❗ Current head 3ca8b29 differs from pull request most recent head 59e89ef. Consider uploading reports for the commit 59e89ef to get more accurate results

Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #1513      +/-   ##
=============================================
- Coverage      34.23%   30.66%   -3.58%     
  Complexity       847      847              
=============================================
  Files            262      298      +36     
  Lines           5953     6647     +694     
  Branches         560      646      +86     
=============================================
  Hits            2038     2038              
- Misses          3722     4416     +694     
  Partials         193      193              
Files Coverage Δ
...o4j/common/boot/AgentPackageNotFoundException.java 0.00% <ø> (ø)
...in/java/cn/hippo4j/common/boot/ClassCacheMode.java 0.00% <ø> (ø)
...hippo4j/common/boot/DefaultNamedThreadFactory.java 0.00% <ø> (ø)
...n/src/main/java/cn/hippo4j/common/conf/Config.java 0.00% <ø> (ø)
...n/hippo4j/common/conf/ConfigNotFoundException.java 0.00% <ø> (ø)
...ppo4j/common/conf/RuntimeContextConfiguration.java 0.00% <ø> (ø)
...java/cn/hippo4j/common/logging/api/LogManager.java 0.00% <ø> (ø)
...java/cn/hippo4j/common/logging/api/NoopLogger.java 0.00% <ø> (ø)
...cn/hippo4j/common/logging/core/AbstractLogger.java 0.00% <ø> (ø)
...ava/cn/hippo4j/common/logging/core/FileWriter.java 0.00% <ø> (ø)
... and 27 more

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@magestacks magestacks merged commit d687133 into opengoofy:develop Aug 9, 2024
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Enhancement] Log printing failure problem in agent mode.
2 participants